<template>
  <section>
    <el-form label-width="100px">
      <el-row type="flex" justify="end">
        <el-button size="medium" type="primary" @click="add">添加</el-button>
      </el-row>
    </el-form>
    <el-table :data="TeacherData" style="width: 100%" :default-sort="{prop: 'date', order: 'descending'}">
      <el-table-column type="index" :index="indexMethod" sortable label="序号" width="180">
      </el-table-column>
      <el-table-column prop="name" label="名称" sortable width="180">
      </el-table-column>
      <el-table-column prop="address" label="考试时间" :formatter="formatter">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button size="medium" @click="Edit">编 辑</el-button>
          <el-button size="medium" type="danger" @click="Delete">删 除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 添加教师页面 -->
    <el-dialog title="添加教师页面" :visible.sync="addTeacher" width="60%" :before-close="handleClose">
      <el-row>
        <el-card>
          <el-form label-width="100px">
            <el-form-item label="姓名">
              <el-input type="text" placeholder="请输入姓名"></el-input>
            </el-form-item>
            <el-form-item label="专业">
              <el-select placeholder="请选择专业">
                <el-option></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="教职工号">
             <el-input type="text" placeholder="请输入教职工号"></el-input>
            </el-form-item>
          </el-form>
          <el-row type="flex" justify="center">
            <el-button type="primary" size="mini">保 存</el-button>
          </el-row>
        </el-card>
      </el-row>
    </el-dialog>
    <!-- 编辑教师页面 -->
      <el-dialog title="编辑教师页面" :visible.sync="addTeacher" width="60%" :before-close="handleClose">
      <el-row>
        <el-card>
          <el-form label-width="100px">
            <el-form-item label="姓名">
              <el-input type="text" placeholder="请输入姓名"></el-input>
            </el-form-item>
            <el-form-item label="专业">
              <el-select placeholder="请选择专业">
                <el-option></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="教职工号">
             <el-input type="text" placeholder="请输入教职工号" disabled></el-input>
            </el-form-item>
          </el-form>
          <el-row type="flex" justify="center">
            <el-button type="primary" size="mini">保 存</el-button>
          </el-row>
        </el-card>
      </el-row>
    </el-dialog>
  </section>
</template>
<script>
export default {
    data() {
        return {
            addTeacher: false,
            TeacherData: []
        };
    },
    methods: {
        indexMethod(index) {
            return index + 1;
        },
        add() {
            this.addTeacher = true;
        }
    }
};
</script>
